<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCWeb.Models.EventPictureGallery>" %>

<%@ Register Src="~/Views/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="mmuc" %>

<%@ Register Src="~/Views/Shared/LogOnUserControl.ascx" TagName="LogOnUserControl" TagPrefix="louc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<title>CreatePicture</title>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>CreatePicture</h2>

    <script type="text/javascript">

        $(document).ready(function() {
        $("#EventForm").validate({
            rules:
            {
                Caption:
                {
                    required: true
                },
                Image: {
                    required: true
                }
            },

            messages:
            {
                Caption:
                {
                    required: "Caption must be entered."
                },
                Image: {
                    required: "Image file cannot be blank."
                } 
            }
        });
        $("#submit_view").click(function() {
            $("#IsRedirectToView").val("true");
        });    
        
        });
    </script>

    <louc:LogOnUserControl ID="LogOnUserControl1" runat="server" />
    <!-- BEGIN: MainMenu -->
    <mmuc:MainMenu ID="MainMenu1" runat="server" />
    <!-- END: MainMenu -->
    <br />
    <%= Html.ValidationSummary() %>
    <% using (Html.BeginForm("CreatePicture", "Event", FormMethod.Post, new { id = "EventForm" ,enctype = "multipart/form-data" })) 
       {%>
        <fieldset>
            <legend>Fields</legend>
            <p>
                <label for="Caption">Caption:</label>
                <%= Html.TextBox("Caption") %>
                <%= Html.ValidationMessage("Caption", "*") %>
            </p>
                        
            <p>
                <label for="ImagePath">Image:</label>
                <input type="file" name="ImagePath" id="ImagePath" size="34" />
            </p>           
            
            <p>
                <%= Html.Hidden("IsRedirectToView")%>
                <input id="submit" name="submit" type="submit" value="Save & New" />
                <input id="submit_view" name="submit_view" type="submit" value="Save & View" />            
                <input type="reset" value="Reset" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%=Html.ActionLink("Back to List", "ManageGallery", new { id = ViewData["EventId"] })%>
    </div>

</asp:Content>

